package com.wx.controller;

import com.wx.entity.User;
import com.wx.entity.WxUserModel;
import com.wx.pojo.JSONResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Random;

@RestController
@RequestMapping("test")
public class TestController extends WxUserModel {

    @GetMapping(value = "/test")
    public JSONResult getUser(HttpServletRequest request) {
        User user = new User();
       user.setName(getUserModel(request).getUsername());
        return JSONResult.ok(user);
    }

    public static void main(String[] args) {

 String item=" ";
 if (item == " "){
     System.out.println(1);
 }
        if (item.equals(" ")){
            System.out.println(2);
        }
        if (item!= " "){
            System.out.println(3);
        }






//        System.out.println(new TestController().generateOrderNo());
    }
    private String generateOrderNo(){
        long currentTime =System.currentTimeMillis();
        String NO="20"+String.valueOf(currentTime+new Random().nextInt(100));
        return NO;
    }

}
